import type { postOrPutType } from "@/constants";
import type { HasId, IList, IResult } from "@/types/common";
import { getAxios, commonAxiosJson, deleteAxios } from "@/utils/request.js";
/* 限时折扣活动 地址 */
const url = "/back/rent-mobile-activity-special-discount";
/* 限时折扣活动数据：获取 限时折扣活动信息 */
export const getRentSpecialDiscountInfo = <T, D>(params?: D): Promise<IResult<IList<T>>> => {
  return getAxios<IList<T>, D>(url, params);
};
/* 限时折扣活动数据：获取 限时折扣活动详情信息 */
export const getRentSpecialDiscountByIdInfo = <T, D extends HasId>(params: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url + "/" + params.id, params);
};
/* 限时折扣活动数据：新增，修改限时折扣活动信息 */
export const commonRentSpecialDiscountInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 限时折扣活动数据：删除 限时折扣活动信息 */
export const deleteRentSpecialDiscountInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return deleteAxios<T, D>(url, params);
};
